1. Field of the Invention
The present invention relates to an image processing apparatus, an image processing method, and a program. More particularly, the present invention relates to an image processing apparatus, an image processing method, and a program that are capable of detecting the motion vector of a moving image with high accuracy.
2. Description of the Related Art
In the related art, image processing apparatuses that determine a motion vector from a plurality of temporally different frames of a moving image, perform motion compensation using the motion vector, and generate an interpolation frame exist (see, for example, Japanese Unexamined Patent Application Publication No. 2004-518339). In such image processing apparatuses, by generating new interpolation frames, a moving image can be viewed more smoothly. For example, it is possible to generate an image at 60 Hz from an image at 30 Hz.
As a method of detecting a motion vector, for example, a block matching method exists. In the block matching method, in a case where a certain block of an f-th frame is set as a subject block, an (f+1)-th frame is set as a reference frame that is referred to for the detection of a motion vector, and a motion vector that is directed from the (f+1)-th frame toward the f-th frame is detected as the motion vector of the subject block, a predetermined range in which the position corresponding to the subject block of the (f+1)-th frame is the center is set as a search range in which a search for the motion vector is performed.
Then, blocks of the same size as the subject block are sequentially selected as candidate blocks that are candidates of the matching result of the subject block from the search range of the (f+1)-th frame, and the subject block is matched with the candidate blocks, thereby obtaining a difference for each pixel. Next, the grand total (hereinafter referred to as a difference absolute value sum) of the absolute value of the difference for each pixel with regard to all the pixels of the subject block is obtained.
Then, when the difference absolute value sum is obtained with regard to all the candidate blocks that can be selected in the search range, a candidate block in which the difference absolute value sum is minimized among the candidate blocks that can be selected in the search range is selected, and a vector that is directed from the subject block toward the candidate block is detected as the motion vector of the subject block.